<!DOCTYPE html>
<%@page import="com.labot.types.ConstantsType"%>
<%@page import="com.labot.webapp.listener.StartupListener"%>
<%@ include file="/common/taglibs.jsp"%>
<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="com.labot.model.User"%>




<html lang="en">
<head>
    <meta http-equiv="Cache-Control" content="no-store"/>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="<c:url value="/images/favicon2.ico"/>"/>
    <title>Bitacora</title>
    

 	<link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/lib/hcolumns-intro.css'/>" />
	<link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/lib/hcolumns.css'/>" />
	<%-- <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/lib/demo_page.css'/>" /> --%>
	<%-- <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/lib/demo_table.css'/>" /> --%>
    <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/lib/bootstrap-2.3.2.min.css'/>" />
    <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/lib/bootstrap-responsive-2.3.2.min.css'/>" />
    <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/style.css'/>" />
    <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/scripts/datepicker/css/datepicker.css'/>" />
 	<link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/jquery-ui.css'/>" />

    <c:if test="${!jqueryProvided}">
    <script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
    <%-- <script type="text/javascript" src="<c:url value='/scripts/lib/jquery.dataTables.js'/>"></script> --%>
    <script type="text/javascript" src="<c:url value='/scripts/lib/jquery-ui.min.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/lib/jquery-ui-sliderAccess.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/lib/jquery-ui-timepicker-addon.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/lib/jquery.foggy.min.js'/>"></script>
    </c:if>
    <script type="text/javascript" src="<c:url value='/scripts/lib/bootstrap-2.3.2.min.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/lib/plugins/jquery.cookie.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/script.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/DwrService.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/engine.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/util.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/scripts/lib/jquery.hcolumns.js'/>"></script>
   	
    <decorator:head/>
    

    
</head>



<body<decorator:getProperty property="body.id" writeEntireProperty="true"/><decorator:getProperty property="body.class" writeEntireProperty="true"/>>
    <c:set var="currentMenu" scope="request"><decorator:getProperty property="meta.menu"/></c:set>

    

    <div class="container-fluid">
        <%@ include file="/common/messages.jsp" %>
        <div class="row-fluid">
            <decorator:body/>
<%--
            <c:if test="${currentMenu == 'AdminMenu'}">
                <div class="span2">
                <menu:useMenuDisplayer name="Velocity" config="navlistMenu.vm" permissions="rolesAdapter">
                    <menu:displayMenu name="AdminMenu"/>
                </menu:useMenuDisplayer>
                </div>
            </c:if>
 --%>
        </div>
    </div>

	<div class="loading">
		<img src="${ ctx }/images/LoadWait.gif"/>
	</div>
    
             
<%= (request.getAttribute("scripts") != null) ?  request.getAttribute("scripts") : "" %>
</body>

<script type="text/javascript">
	var idTimeOut = null;
	var idWarningTimeOut = null;
	
	function resetTimeOut() {
		window.clearInterval(idTimeOut);
		window.clearInterval(idWarningTimeOut);
		idTimeOut = null;
		idWarningTimeOut = null;
		$('#warningSessionTimeOut').hide();
		createTimeOut();
	}
	
	function messageFromAdmin() {		
		DwrService.getMessageFromAdmin({
			  callback:function(obj) {
				  if(obj.message != null) {					  
				  	  $('#spanMessageFromAdmin').text(obj.message);
				  	  $('#messageFromAdmin').show();
				  } else {
					  $('#messageFromAdmin').hide();
				  }
				 }  
		});
	}
	
	function sessionTimeOutWarning() {		
	  	$('#warningSessionTimeOut').show();
	  	idTimeOut = window.setInterval(function(){
	  		window.location = "<%= getServletContext().getContextPath() %>/logout";  
			}, <%= StartupListener.getConfigValue(ConstantsType.LOGOUT_TIME) %> * 1000);
	}
	
	messageFromAdmin();
	window.setInterval(function(){
		messageFromAdmin();  
		}, 10000);
	
	
	function createTimeOut() {		
		if (window.location.href.indexOf("login") == -1) {		
			idWarningTimeOut = window.setInterval(function(){
				sessionTimeOutWarning();  
				}, <%= StartupListener.getConfigValue(ConstantsType.LOGOUT_WARNING_TIME) %> * 1000);
		}
	}
	
	createTimeOut();
	
	$.datepicker.regional['es'] = {
			closeText: 'Cerrar',
			prevText: '<-',
			nextText: '->',
			currentText: '',
			monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
			'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
			monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
			'Jul','Ago','Sep','Oct','Nov','Dic'],
			dayNames: ['Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sabado'],
			dayNamesShort: ['Dom','Lun','Mar','Mie','Jue','Vie','Sab'],
			dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sa'],
			weekHeader: 'Sem',
			dateFormat: 'dd/mm/yy',
			firstDay: 1,
			isRTL: false,
			showMonthAfterYear: false,
			yearSuffix: ''
			
		};
	$.datepicker.setDefaults($.datepicker.regional['${ pageContext.request.locale.language }']);


	$( ".form" ).submit(function() {
		
		  loading();
		  return true;
		});
	
	function loading() {
		setTimeout(function () {
			$('.container-fluid').foggy({
				   blurRadius: 2,          // In pixels.
				   opacity: 0.8,           // Falls back to a filter for IE.
				   cssFilterSupport: true  // Use "-webkit-filter" where available.
				 });
			$('.loading').show();
		}, 300);
		return true;
	}
	
	function loadingoff() {
		 setTimeout(function () {
			$('.container-fluid').foggy(false);
			$('.loading').hide();
		 }, 1000);
	}
			  
</script>

</html>

